Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
MongoDB/node.js - ¿Cómo encontrar todas las películas del mismo género por "Nombre"?

Estoy construyendo una aplicación de estilo 'netflix' para practicar. En él, quiero que el usuario pueda encontrar todas las películas de un determinado género escribiendo la siguiente url:

http://localhost:8080/movies/Aventura

Pero parece que me estoy equivocando en alguna parte, porque la lista devuelve nulo... aquí está mi código:

 app.get('/movies/:genre', (req, res) => { Movies.find({ Genre: { Name: req.params.genre } }).populate('Genre Director Actors') .then((movie) => { res.json(movie); }).catch((err) => { console.error(err); res.status(500).send('Error: ' + err); }); });

y estos son los datos de MongoDB:

 "Genre": [ { "_id": "611b4b465bf9b8645dd32ef9", "Name": "Animated", "Description": "Animation is a method in which pictures are manipulated to appear as moving images. In traditional animation, images are drawn or painted by hand on transparent celluloid sheets to be photographed and exhibited on film." } ], "Actors": [ { "_id": "611bd09659f7b8323ad90441", "Name": "Johnny Depp", "Bio": "John Christopher Depp II is an American actor, producer, and musician. He is the recipient of various accolades, including a Golden Globe Award and a Screen Actors Guild Award, in addition to nominations for three Academy Awards and two British Academy Film Awards.", "Birth": "1963-06-09", "Death": "N/A" } ], "_id": "611c06f4cb359ae2b8220245", "Title": "Rango", "Description": "A chameleon (Johnny Depp) who has lived as a sheltered family pet finds himself in the grip of an identity crisis. Rango wonders how to stand out when it is his nature to blend in. When he accidentally winds up in a frontier town called Dirt, he takes the first step on a transformational journey as the town's new sheriff. Though at first Rango only role-plays, a series of thrilling situations and outrageous encounters forces him to become a real hero.", "Director": { "_id": "611b4f835bf9b8645dd32efe", "Name": "Gore Verbinski", "Bio": "Gregor Justin 'Gore' Verbinski is an American film director, screenwriter, producer, and musician. He is best known for directing The Ring, the Pirates of the Caribbean films, and Rango.", "Birth": "1964-03-16", "Death": "N/A" }, "ImagePath": "rango.png", "Featured": false }

¡Toda ayuda es apreciada!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Movies.find({ "Genre.Name": req.params.genre })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!